﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Prodma.DataAccess.Models.ViewModels;
using Prodma.DataAccess.Database;
using Prodma.DataAccess.DataService;

namespace Prodma.Panel.Controllers
{
    public class ProductsPageController : Controller
    {
        //
        // GET: /ProductsPage/
        private UrunlerService service = new UrunlerService();
        public ProductsPageController()
        {
        }

        public ActionResult Index(int? page)
        {
            page = 0;
            var products = service.FindProducts();
            var pagedProducts = new PagedObject<UrunlerVm>(products, page ?? 0, 6);

            if (products == null)
                return View("UserNotFound");
            else
                return View("Index", pagedProducts);
        }

        

        

    }
}
